#pragma once
#include<pthread.h>
#include"Mutex.hpp"
namespace CondModule
{
    using namespace LockModule;
    class Cond
    {
    public:
        Cond()
        {
            ::pthread_cond_init(&_cond,nullptr);
        }
        void Wait(Mutex &mutex)
        {
            ::pthread_cond_wait(&_cond,mutex.MutexPtr());
        }
        void Notify()
        {
            ::pthread_cond_signal(&_cond);
        }
        void NotifyAll()
        {
            ::pthread_cond_broadcast(&_cond);
        }

    private:
        pthread_cond_t _cond;

    };
}